﻿module Enferno.Public.Web.Components.Models {
    
    export class ParametricValueModel {
        constructor(serverObject?: any) {

            if (serverObject != null) {
                this.id = serverObject.id;
                this.name = serverObject.name;
                this.description = serverObject.description;
                this.imageUrl = serverObject.imageUrl;
                this.code = serverObject.code;
                this.value = serverObject.value;
                this.sortOrder = serverObject.sortOrder;
            }
        }

        public toString(): string {
            if (this.id != null)
                return this.id.toString();
            return this.value;
        }

        public equals(otherValue: ParametricValueModel): boolean {
            if (this.id != null && this.id != 0) {
                return this.id == otherValue.id;
            } else {
                return this.value == otherValue.value;
            }
        }

        public id: number;
        public name: string;
        public description: string;
        public imageUrl: string;
        public code: string;
        public value: string;
        public sortOrder: number;
    }

} 